package com.jt.controller;

import com.jt.pojo.Role;
import com.jt.service.RoleService;
import com.jt.vo.PageResult;
import com.jt.vo.SysResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping("/role")
public class RoleController {

    @Autowired
   private RoleService  roleService;

    @RequestMapping("/list")
    public SysResult  getRolePage(PageResult pageResult){
        System.out.println("数据访问过来了");
        PageResult list = roleService.getList(pageResult);


        return  SysResult.success(list);
    }

    //为用户的访问来提供数据的
    @RequestMapping("/roleList")
    public SysResult  getRoleList(){
        List<Role> roleList = roleService.getRoleList();
        for (Role role : roleList) {
            System.out.println(role);
        }


        return  SysResult.success(roleList);
    }



}
